package cn.sunshine.framework.context.event;

import cn.sunshine.framework.beans.factory.BeanFactory;
import cn.sunshine.framework.context.ApplicationEvent;
import cn.sunshine.framework.context.ApplicationListener;

/**
 * @Description cn.sunshine.framework.context.event
 * @Author Mokairui
 * @Since 2021/12/18
 */
public class SimpleApplicationEventMulticaster extends AbstractApplicationEventMulticaster {

    public SimpleApplicationEventMulticaster(BeanFactory beanFactory) {
        setBeanFactory(beanFactory);
    }

    @Override
    public void multicastEvent(ApplicationEvent event) {
        for (final ApplicationListener listener : getApplicationListeners(event)) {
            listener.onApplicationEvent(event);
        }
    }
}
